home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-10-04 | 3.1 KB | 110 lines |
-
- package sub_arctic.lib;
-
- import sub_arctic.output.loaded_image;
- import sub_arctic.output.drawable;
-
- /**
- * A simple interactor that just fills its area with a pattern, but
- * otherwise does nothing.
- *
- * @author Scott Hudson
- */
- public class backdrop extends base_interactor {
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /** The background pattern that we fill our area with. */
- protected loaded_image _pattern = null;
-
- /** The background pattern that we fill our area with. */
- public loaded_image pattern() {return _pattern;};
-
- /** Set the background pattern */
- public void set_pattern(loaded_image pat)
- {
- if (pat != _pattern)
- {
- _pattern = pat;
- damage_self();
- }
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Full constructor.
- *
- * @param int xv x position of the area.
- * @param int yv y position of the area.
- * @param int wv width of the area.
- * @param int hv height of the area.
- * @param loaded_image pat the pattern we tile the area with.
- */
- public backdrop(int xv, int yv, int wv, int hv, loaded_image pat)
- {
- super(xv,yv,wv,hv);
- set_pattern(pat);
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Constructor assuming default position of 0,0.
- *
- * @param int wv width of the area.
- * @param int hv height of the area.
- * @param loaded_image pat the pattern we tile the area with.
- */
- public backdrop(int wv, int hv, loaded_image pat)
- {
- super(0,0,wv,hv);
- set_pattern(pat);
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Constructor assuming default position of 0,0, and (temporary)
- * default size. Typically size will be constrained to something.
- *
- * @param loaded_image pat the pattern we tile the area with.
- */
- public backdrop(loaded_image pat)
- {
- super(0,0,64,64);
- set_pattern(pat);
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Draw self using pattern fill.
- * @param drawable d the drawing surface we place our output on.
- */
- protected void draw_self_local(drawable d)
- {
- if (pattern() != null)
- d.tileImage(pattern(), 0, 0, w()-1, h()-1);
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- }
- /*=========================== COPYRIGHT NOTICE ===========================
-
- This file is part of the subArctic user interface toolkit.
-
- Copyright (c) 1996 Scott Hudson and Ian Smith
- All rights reserved.
-
- The subArctic system is freely available for most uses under the terms
- and conditions described in
- http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html
- and appearing in full in the lib/interactor.java source file.
-
- The current release and additional information about this software can be
- found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
-
- ========================================================================*/
-